package c.e.a.c.o;

import android.animation.Animator;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.animation.StateListAnimator;
import android.content.Context;
import android.content.res.ColorStateList;
import android.graphics.PorterDuff.Mode;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.LayerDrawable;
import android.graphics.drawable.RippleDrawable;
import android.os.Build.VERSION;
import android.view.View;
import c.e.a.c.s.b;
import c.e.a.c.t.g;
import c.e.a.c.t.j;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import java.util.ArrayList;
import java.util.Objects;

/* compiled from: FloatingActionButtonImplLollipop */
public class h extends e {

    /* compiled from: FloatingActionButtonImplLollipop */
    public static class a extends g {
        public a(j jVar) {
            super(jVar);
        }

        public boolean isStateful() {
            return true;
        }
    }

    public h(FloatingActionButton floatingActionButton, b bVar) {
        super(floatingActionButton, bVar);
    }

    public float d() {
        return this.y.getElevation();
    }

    public void e(Rect rect) {
        if (FloatingActionButton.this.l) {
            super.e(rect);
        } else if (u()) {
            rect.set(0, 0, 0, 0);
        } else {
            int sizeDimension = (this.k - this.y.getSizeDimension()) / 2;
            rect.set(sizeDimension, sizeDimension, sizeDimension, sizeDimension);
        }
    }

    public void f(ColorStateList colorStateList, Mode mode, ColorStateList colorStateList2, int i) {
        Drawable layerDrawable;
        j jVar = this.a;
        Objects.requireNonNull(jVar);
        a aVar = new a(jVar);
        this.b = aVar;
        aVar.setTintList(colorStateList);
        if (mode != null) {
            this.b.setTintMode(mode);
        }
        this.b.n(this.y.getContext());
        if (i > 0) {
            Context context = this.y.getContext();
            j jVar2 = this.a;
            Objects.requireNonNull(jVar2);
            a aVar2 = new a(jVar2);
            int b = b.i.c.a.b(context, 2131099745);
            int b2 = b.i.c.a.b(context, 2131099744);
            int b3 = b.i.c.a.b(context, 2131099742);
            int b4 = b.i.c.a.b(context, 2131099743);
            aVar2.i = b;
            aVar2.j = b2;
            aVar2.k = b3;
            aVar2.l = b4;
            float f = (float) i;
            if (aVar2.h != f) {
                aVar2.h = f;
                aVar2.b.setStrokeWidth(f * 1.3333f);
                aVar2.n = true;
                aVar2.invalidateSelf();
            }
            aVar2.b(colorStateList);
            this.d = aVar2;
            Drawable[] drawableArr = new Drawable[2];
            aVar2 = this.d;
            Objects.requireNonNull(aVar2);
            drawableArr[0] = aVar2;
            g gVar = this.b;
            Objects.requireNonNull(gVar);
            drawableArr[1] = gVar;
            layerDrawable = new LayerDrawable(drawableArr);
        } else {
            this.d = null;
            layerDrawable = this.b;
        }
        RippleDrawable rippleDrawable = new RippleDrawable(c.e.a.c.r.a.b(colorStateList2), layerDrawable, null);
        this.c = rippleDrawable;
        this.e = rippleDrawable;
    }

    public void i() {
    }

    public void j() {
        w();
    }

    public void k(int[] iArr) {
        if (VERSION.SDK_INT != 21) {
            return;
        }
        if (this.y.isEnabled()) {
            this.y.setElevation(this.h);
            if (this.y.isPressed()) {
                this.y.setTranslationZ(this.j);
                return;
            } else if (this.y.isFocused() || this.y.isHovered()) {
                this.y.setTranslationZ(this.i);
                return;
            } else {
                this.y.setTranslationZ(0.0f);
                return;
            }
        }
        this.y.setElevation(0.0f);
        this.y.setTranslationZ(0.0f);
    }

    public void l(float f, float f2, float f3) {
        int i = VERSION.SDK_INT;
        if (i == 21) {
            this.y.refreshDrawableState();
        } else {
            StateListAnimator stateListAnimator = new StateListAnimator();
            stateListAnimator.addState(e.G, y(f, f3));
            stateListAnimator.addState(e.H, y(f, f2));
            stateListAnimator.addState(e.I, y(f, f2));
            stateListAnimator.addState(e.J, y(f, f2));
            AnimatorSet animatorSet = new AnimatorSet();
            ArrayList arrayList = new ArrayList();
            arrayList.add(ObjectAnimator.ofFloat(this.y, "elevation", new float[]{f}).setDuration(0));
            if (i >= 22 && i <= 24) {
                arrayList.add(ObjectAnimator.ofFloat(this.y, View.TRANSLATION_Z, new float[]{r9.getTranslationZ()}).setDuration(100));
            }
            arrayList.add(ObjectAnimator.ofFloat(this.y, View.TRANSLATION_Z, new float[]{0.0f}).setDuration(100));
            animatorSet.playSequentially((Animator[]) arrayList.toArray(new Animator[0]));
            animatorSet.setInterpolator(e.F);
            stateListAnimator.addState(e.K, animatorSet);
            stateListAnimator.addState(e.L, y(0.0f, 0.0f));
            this.y.setStateListAnimator(stateListAnimator);
        }
        if (s()) {
            w();
        }
    }

    public boolean o() {
        return false;
    }

    public void q(ColorStateList colorStateList) {
        Drawable drawable = this.c;
        if (drawable instanceof RippleDrawable) {
            ((RippleDrawable) drawable).setColor(c.e.a.c.r.a.b(colorStateList));
        } else if (drawable != null) {
            drawable.setTintList(c.e.a.c.r.a.b(colorStateList));
        }
    }

    public boolean s() {
        return FloatingActionButton.this.l || !u();
    }

    public void v() {
    }

    public final Animator y(float f, float f2) {
        AnimatorSet animatorSet = new AnimatorSet();
        animatorSet.play(ObjectAnimator.ofFloat(this.y, "elevation", new float[]{f}).setDuration(0)).with(ObjectAnimator.ofFloat(this.y, View.TRANSLATION_Z, new float[]{f2}).setDuration(100));
        animatorSet.setInterpolator(e.F);
        return animatorSet;
    }
}
